﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Effects;
using System.Windows.Markup;

namespace WpfEffect3._5
{
    /// <summary>
    /// PageBevelBitmapEffect.xaml 的交互逻辑
    /// </summary>
    public partial class PageBevelBitmapEffect : Page
    {
        public PageBevelBitmapEffect()
        {
            InitializeComponent();

            rbBulgedUp.Checked += new RoutedEventHandler(EdgeProfile_Checked);
            rbCurvedIn.Checked += new RoutedEventHandler(EdgeProfile_Checked);
            rbCurvedOut.Checked += new RoutedEventHandler(EdgeProfile_Checked);
            rbLiner.Checked += new RoutedEventHandler(EdgeProfile_Checked);

            effect.Changed += new EventHandler(effect_Changed);
           
        }

        void effect_Changed(object sender, EventArgs e)
        {
            textBox1.Text = XamlWriter.Save(effect);
        }

        //凸凹效果
        void EdgeProfile_Checked(object sender, RoutedEventArgs e)
        {
            if (rbBulgedUp.IsChecked == true)
                effect.EdgeProfile = EdgeProfile.BulgedUp;

            if (rbCurvedIn.IsChecked == true)
                effect.EdgeProfile = EdgeProfile.CurvedIn;

            if (rbCurvedOut.IsChecked == true)
                effect.EdgeProfile = EdgeProfile.CurvedOut;

            if (rbLiner.IsChecked == true)
                effect.EdgeProfile = EdgeProfile.Linear;
        }

    }
}
